package sctu.edu.java.year2016.team01.chenhong.day20160521.chapter5_2;

/**
 * Created by Administrator on 2016/5/22.
 * 创建一维数组，输出数组最大值
 */
public class Maximum {
    public static void main(String[] args) {

        int[] arr = new int[]{4, 18, 5, 9, 11, 43};
        System.out.println("输出arr数组：");


        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + "  ");
        }




        int max = arr[0];
        int j;
        for (j = 0; j < arr.length - 1; j++) {
            if (max < arr[j + 1]) ;
            {
                max = arr[j + 1];
            }
        }


        System.out.println("\narr数组的最大值为：" + max);

    }
}
